package cn.yuyiling.jelly.qa.mapper;

import cn.yuyiling.jelly.qa.dto.QuestionDTO;
import cn.yuyiling.jelly.qa.mongodb.entity.Question;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.factory.Mappers;

@Mapper
public interface QuestionMapper {

    QuestionMapper INSTANCE = Mappers.getMapper(QuestionMapper.class);

    @Mapping(source = "knowledgePoints", target = "knowledgePoints")
    @Mapping(source = "content", target = "content")
    @Mapping(source = "metadata", target = "metadata")
    Question dtoToEntity(QuestionDTO dto);

    @Mapping(target = "knowledgePoints", source = "knowledgePoints")
    @Mapping(target = "content", source = "content")
    @Mapping(target = "metadata", source = "metadata")
    QuestionDTO entityToDto(Question entity);

}
